package com.zxgllhh.config;

import freemarker.template.Configuration;
import freemarker.template.DefaultObjectWrapper;
import freemarker.template.Template;

/**
 * 
 * @author Zhao,XingGuo
 * @version 1.0 build 09.8.6
 * 
 */
public class FreemarkerManager {

	public static Configuration getConfiguration() {
		Configuration cfg = new Configuration();
		cfg.setClassForTemplateLoading(FreemarkerManager.class, "templates");
		cfg.setObjectWrapper(new DefaultObjectWrapper());
		cfg.setDefaultEncoding("UTF-8");
		return cfg;
	}

	public static Template getDaoTemplate() throws Exception {
		Template temp = FreemarkerManager.getConfiguration().getTemplate("dao.ftl");
		return temp;
	}

	public static Template getDaoImplTemplate() throws Exception {
		Template temp = FreemarkerManager.getConfiguration().getTemplate("daoimpl.ftl");
		return temp;
	}

	public static Template getServiceTemplate() throws Exception {
		Template temp = FreemarkerManager.getConfiguration().getTemplate("service.ftl");
		return temp;
	}

	public static Template getServiceImplTemplate() throws Exception {
		Template temp = FreemarkerManager.getConfiguration().getTemplate("serviceimpl.ftl");
		return temp;
	}

	public static Template getFacadeTemplate() throws Exception {
		Template temp = FreemarkerManager.getConfiguration().getTemplate("facade.ftl");
		return temp;
	}

	public static Template getFacadeImplTemplate() throws Exception {
		Template temp = FreemarkerManager.getConfiguration().getTemplate("facadeimpl.ftl");
		return temp;
	}

	public static Template getDomainTemplate() throws Exception {
		Template temp = FreemarkerManager.getConfiguration().getTemplate("domain.ftl");
		return temp;
	}

	public static Template getMysqlMapsTemplate() throws Exception {
		Template temp = FreemarkerManager.getConfiguration().getTemplate("mysqlmaps.ftl");
		return temp;
	}
	
	public static Template getOracleMapsTemplate() throws Exception {
		Template temp = FreemarkerManager.getConfiguration().getTemplate("oraclemaps.ftl");
		return temp;
	}

	public static Template getSqlMapConfigTemplate() throws Exception {
		Template temp = FreemarkerManager.getConfiguration().getTemplate("sqlmapconfig.ftl");
		return temp;
	}

	public static Template getActionTemplate() throws Exception {
		Template temp = FreemarkerManager.getConfiguration().getTemplate("action.ftl");
		return temp;
	}

	public static Template getListPageTemplate() throws Exception {
		Template temp = FreemarkerManager.getConfiguration().getTemplate("list.ftl");
		return temp;
	}

	public static Template getViewPageTemplate() throws Exception {
		Template temp = FreemarkerManager.getConfiguration().getTemplate("view.ftl");
		return temp;
	}
	
	public static Template getFormPageTemplate() throws Exception {
		Template temp = FreemarkerManager.getConfiguration().getTemplate("form.ftl");
		return temp;
	}
}
